<html>

<head>
<title>Abstract Factory Pattern</title>
<link rel="stylesheet" type="text/css" href="../../../style.css">
</head>

<body>

<h1>Abstract Factory</h1>
<ul>
  <li><a href="#Purpose">Purpose</a></li>
  <li><a href="#Structure">Structure</a></li>
  <li><a href="#Applications">Applications</a></li>
  <li><a href="#Consequences">Consequences</a></li>
</ul>
<h2><a name="Purpose">Purpose</a></h2>
<ul type="square">
  <li>Provide an interface for creating families of related or dependent objects 
	without specifying their concrete classes.</li>
</ul>
<h2><a name="Structure">Structure</a></h2>
<p>&nbsp;
<img border="0" src="AbstractFactory_Model1.gif" width="663" height="289"></p>
<ul type="square">
  <li><b>AbstractFactory :</b> Declares an interface for operations that create 
	abstract product objects.</li>
  <li><b>ConcreteFactory :</b> Implements the operations to create concrete 
	product objects.</li>
  <li><b>AbstractProduct :</b> Declares an interface for a type of product 
	object.</li>
  <li><b>ConcreteProduct:</b> Defines a product object to be created by the 
	corresponding concrete factory.</li>
  <li><b>Client :</b> Uses only interfaces declared by AbstractFactory and 
	AbstractProduct classes.</li>
</ul>
<h2><a name="Applications">Applications</a></h2>
<ul type="square">
  <li>a system should be independent of how its products are created, composed, 
	and represented.</li>
  <li>a system should be configured with one of multiple families of products.</li>
  <li>a family of related product objects is designed to be used together, and 
	you need to enforce this constraint.</li>
  <li>you want to provide a class library of products, and you want to reveal 
	just their interfaces, not their implementations.</li>
</ul>
<h2><a name="Consequences">Consequences</a></h2>
<ul type="square">
  <li><b>It isolates concrete classes. </b>The Abstract Factory pattern helps 
	you control the classes of objects that an application creates. Because a 
	factory encapsulates the responsibility and the process of creating product 
	objects, it isolates clients from implementation classes. Clients manipulate 
	instances through their abstract interfaces. Product class names are 
	isolated in the implementation of the concrete factory; they do not appear 
	in client code.</li>
  <li><b>It makes exchanging product families easy. </b>The class of a concrete 
	factory appears only once in an application&#8212;that is, where it's 
	instantiated. This makes it easy to change the concrete factory an 
	application uses. It can use different product configurations simply by 
	changing the concrete factory. Because an abstract factory creates a 
	complete family of products, the whole product family changes at once.</li>
  <li><b>It promotes consistency among products. </b>When product objects in a 
	family are designed to work together, it's important that an application use 
	objects from only one family at a time.<br>
	AbstractFactory makes this easy to enforce.</li>
  <li><b>Supporting new kinds of products is difficult. </b>Extending abstract 
	factories to produce new kinds of Products isn't easy. That's because the 
	AbstractFactory interface fixes the set of products that can be created. 
	Supporting new kinds of products requires extending the factory interface, 
	which involves changing the AbstractFactory class and all of its subclasses.</li>
</ul>

</body>

</html>
